package org.meb.conquest.web.model;

import java.util.ArrayList;
import java.util.List;

import lombok.Getter;
import lombok.Setter;

import org.meb.conquest.db.model.Deck;
import org.meb.conquest.db.model.DeckMember;

@Getter
@Setter
public class DeckItem {

	private Deck deck;
	private List<CardItem> cards;
	private CardGroup cardGroup;

	public DeckItem(Deck deck) {
		this.deck = deck;
		cards = new ArrayList<>();
		for (DeckMember deckMember : deck.getDeckMembers()) {
			cards.add(new CardItem(deckMember.getCard(), deckMember.getQuantity()));
		}
		cardGroup = new CardGroup();
		cardGroup.groupByType(cards);
	}
}
